package gtkwire.widget;

import gtkwire.*;
import gtkwire.widget.utils.PangoEllipsizeMode;

/**
*A widget which indicates progress visually.
*Documentation for this class is from the gtk+ .c file that this class binds to. See original file for copyrights.
*/
public class GtkProgressBar extends GtkProgress
{
	/**
	*Used to set progeress direction LEFT_TO_RIGHT.
	*/
	public static final int LEFT_TO_RIGHT = 0;
	/**
	*Used to set progeress direction RIGHT_TO_LEFT
	*/
	public static final int RIGHT_TO_LEFT = 1;
	/**
	*Used to set progeress direction BOTTOM_TO_TOP
	*/
	public static final int BOTTOM_TO_TOP = 2;
	/**
	*Used to set progeress direction TOP_TO_BOTTOM
	*/
	public static final int TOP_TO_BOTTOM = 3;

        public GtkProgressBar()
        {
		super();
		this.widgetType = WT_GtkProgressBar;
		gtkCreate();
        }

        public GtkProgressBar( String name, GladeKey key )
        {
		super( name, key );
		this.widgetType = WT_GtkProgressBar;
        }

	/**
	*Causes the progress bar to "fill in" the given fraction of the bar. The fraction should be between 0.0 and 1.0, inclusive.
	*/
	public void setFraction( double fraction )
	{
		app().sendCommand( name, GTKWireCommand.SET_VALUE, fraction );
	}

	/**
	*Causes the given text to appear superimposed on the progress bar.
	*/
	public void setText( String text )
	{
		app().sendCommand( name, GTKWireCommand.SET_TEXT, text );
	}

	/**
	*Causes the progress bar to enter "activity mode," where a block bounces back and forth. 
	*Each call to gtk_progress_bar_pulse() causes the block to move by a little bit
	*/
	public void pulse()
	{
		app().sendCommand( name, GTKWireCommand.PULSE );
	}

	/**
	*Sets the fraction of total progress bar length to move the bouncing block for each call to pulse.
	*/
	public void setStep( double fraction )
	{
		app().sendCommand( name, GTKWireCommand.SET_STEP, fraction );
	}
	
	/**
	*Sets the mode used to ellipsize (add an ellipsis: "...") the text if there is not enough space to render the entire string.
	*/
	public void setEllipsize( PangoEllipsizeMode emode )
	{
		app().sendCommand( name, GTKWireCommand.SET_STEP, emode.getMode() );
	}

	/**
	*Causes the progress bar to switch to a different orientation. See member field values.
	*/
	public void setOrientation( int orientation )
	{
		app().sendCommand( name, GTKWireCommand.SET_ORIENTATION, orientation );
	}

}//end class